home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Hello / Include / HelloPrt.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.9 KB  |  138 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                HelloPrt.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef HELLOPRT_H
  11. #define HELLOPRT_H
  12.  
  13. #ifndef HELLODEF_H
  14. #include "HelloDef.h"
  15. #endif
  16.  
  17. // ----- Framework Includes -----
  18.  
  19. #ifndef FWPART_H
  20. #include "FWPart.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWRESFIL_H
  26. #include "FWResFil.h"
  27. #endif
  28.  
  29. // ----- Foundation Layer -----
  30.  
  31. #ifndef FWSTDDEF_H
  32. #include "FWStdDef.h"
  33. #endif
  34.  
  35. #ifndef FWBNDSTR_H
  36. #include "FWBndStr.h"
  37. #endif
  38.  
  39.  
  40. //========================================================================================
  41. // Forward Declarations
  42. // Any references to imported classes (FW_) have to be wrapped in import on/off
  43. // because SCpp won't import their methods otherwise. This is a temporary bug fix.
  44. //========================================================================================
  45.  
  46. #if FW_LIB_EXPORT_PRAGMAS
  47. #pragma import on
  48. #endif
  49. class FW_CLASS_ATTR FW_CPart;
  50. class FW_CLASS_ATTR FW_CString;
  51. class FW_CLASS_ATTR FW_CMenuBar;
  52. class FW_CLASS_ATTR FW_CMenuEvent;
  53. class FW_CLASS_ATTR FW_CPresentation;
  54. #if FW_LIB_EXPORT_PRAGMAS
  55. #pragma import off
  56. #endif
  57.  
  58. //========================================================================================
  59. // CHelloPart
  60. //========================================================================================
  61.  
  62. class FW_CLASS_ATTR CHelloPart : public FW_CPart
  63. {
  64. //----------------------------------------------------------------------------------------
  65. //    Initialization/Destruction
  66. //
  67. public:
  68.     CHelloPart(ODPart* odPart);
  69.     virtual ~CHelloPart();
  70.  
  71.     virtual void Initialize(Environment* ev);    // Override
  72.  
  73. //----------------------------------------------------------------------------------------
  74. //    Inherited API
  75. //
  76. public:
  77.     virtual FW_CFrame*    NewFrame(Environment* ev,
  78.                                  ODFrame* odFrame,
  79.                                  FW_CPresentation* presentation,
  80.                                  FW_Boolean fromStorage);
  81.  
  82.     virtual FW_Boolean    DoAdjustMenus(Environment* ev,
  83.                                       FW_CMenuBar* menuBar, 
  84.                                       FW_Boolean hasMenuFocus,
  85.                                       FW_Boolean isRoot);
  86.  
  87.     virtual FW_Boolean    DoMenu(Environment* ev,
  88.                                const FW_CMenuEvent& theMenuEvent);
  89.  
  90.     virtual void        ExternalizeContent(Environment *ev,
  91.                                            ODStorageUnit* storageUnit,
  92.                                            FW_CCloneInfo* cloneInfo);
  93.                                     
  94.     virtual void        InternalizeContent(Environment *ev,
  95.                                            ODStorageUnit* storageUnit, 
  96.                                            FW_CCloneInfo* cloneInfo);
  97.  
  98.     virtual void        AddProperties(Environment *ev, ODStorageUnit* storageUnit);
  99.  
  100. //----------------------------------------------------------------------------------------
  101. //    New API
  102. //
  103. public:
  104.     const FW_CString&     GetTextData();
  105.     void                ClearTextData();
  106.     void                SetTextData(const FW_CString& newText);
  107.  
  108.     void                GetData(Environment* ev, FW_Boolean& setting, FW_CString& string);
  109.     void                SetData(Environment* ev, FW_Boolean setting, const FW_CString& string);
  110.     void                ClearData(Environment* ev, FW_Boolean setting);
  111.  
  112.     void                 DoHelloCommand(Environment* ev, ODCommandID id);
  113.         // Handle our two menu commands, cFirstCommand and cSecondCommand
  114.  
  115.     void                 GetResourceString(FW_ResourceId multiStringId,
  116.                                            FW_ResourceId stringId,
  117.                                            FW_CString& string);
  118.         // Retrieve a string from a multi-string resource in the part's resource file
  119.  
  120.     void                PartChanged(Environment* ev);
  121.         // Call this after changing part data, to notify the proper authorities
  122.  
  123.     static const ODValueType kPartKind;
  124.     static const ODValueType kPartUserName;
  125.  
  126. //----------------------------------------------------------------------------------------
  127. //    Data Members
  128. //
  129. private:
  130.     FW_CString255        fTextData1;            // first string
  131.     FW_CString255        fTextData2;            // second string
  132.     FW_Boolean            fIsFirstString;        // is first string showing?
  133.     FW_CPresentation*    fPresentation;
  134. };
  135.  
  136.  
  137. #endif
  138.